<Directory "%APACHE_DOCUMENT_ROOT_VIRTUALS/%VIRT_WWW_NAME/data/">
   Deny from all
</Directory>

<VirtualHost %LOCAL_IP:80>
   ServerName %VIRT_WWW_NAME
   
   DocumentRoot "%APACHE_DOCUMENT_ROOT_VIRTUALS/%VIRT_WWW_NAME/"

   ErrorLog logs/%VIRT_WWW_NAME/error_log
   CustomLog logs/%VIRT_WWW_NAME/access_log twist

   <Directory "%APACHE_DOCUMENT_ROOT_VIRTUALS/%VIRT_WWW_NAME/">
      AllowOverride All
      Require all granted
   </Directory> 

   # Proxy declaration for PHP-FPM
   <Proxy "unix:/var/opt/rh/rh-php72/run/php-fpm/%VIRT_WWW_NAME.sock|fcgi://php-fpm">
      # we must declare a parameter in here (doesn't matter which) or it'll not register the proxy ahead of time
      ProxySet disablereuse=off
      # Note: If you configure php-fpm to use the "ondemand" process manager, then use "ProxySet disablereuse=on"
   </Proxy>

   # Redirect to the proxy
   <FilesMatch \.php$>
      SetHandler proxy:fcgi://php-fpm
   </FilesMatch>

</VirtualHost>

<VirtualHost %LOCAL_IP:443>
   ServerName %VIRT_WWW_NAME

   DocumentRoot "%APACHE_DOCUMENT_ROOT_VIRTUALS/%VIRT_WWW_NAME/"

   ErrorLog logs/%VIRT_WWW_NAME/error_log
   CustomLog logs/%VIRT_WWW_NAME/access_log twist

   Include  conf/ssl/ssl_include.conf

   <Directory "%APACHE_DOCUMENT_ROOT_VIRTUALS/%VIRT_WWW_NAME/">
      AllowOverride All
      Require all granted
   </Directory> 

   # Proxy declaration for PHP-FPM
   <Proxy "unix:/var/opt/rh/rh-php72/run/php-fpm/%VIRT_WWW_NAME.sock|fcgi://php-fpm">
      # we must declare a parameter in here (doesn't matter which) or it'll not register the proxy ahead of time
      ProxySet disablereuse=off
      # Note: If you configure php-fpm to use the "ondemand" process manager, then use "ProxySet disablereuse=on"
      ProxySet timeout=300
   </Proxy>

   # Redirect to the proxy
   <FilesMatch \.php$>
      SetHandler proxy:fcgi://php-fpm
   </FilesMatch>

</VirtualHost>
